package com.gitee.wsl.mathematics.vector.ext

import com.gitee.wsl.mathematics.vector.Vector
import com.gitee.wsl.mathematics.vector.vec2.Vector2
import com.gitee.wsl.mathematics.vector.vec3.Vector3
import com.gitee.wsl.mathematics.vector.vec4.Vector4

/*
operator fun<K: Vector2<T, *>> div(other: K) = other.create(x / other.x, y / other.y)
operator fun<K: Vector3<T, *>> div(other: K) = other.create(x / other.x, y / other.y, POSITIVE_INFINITY)
operator fun<K: Vector4<T, *>> div(other: K) = other.create(x / other.x, y / other.y, POSITIVE_INFINITY, POSITIVE_INFINITY)

operator fun<K: Vector2<T, *>> div(other: K) =       create(x / other.x, y / other.y, POSITIVE_INFINITY)
operator fun<K: Vector3<T, *>> div(other: K) = other.create(x / other.x, y / other.y, z / other.z)
operator fun<K: Vector4<T, *>> div(other: K) = other.create(x / other.x, y / other.y, z / other.z, POSITIVE_INFINITY)

operator fun div(other: Vector2<T, *>) = create(x / other.x, y / other.y, POSITIVE_INFINITY, POSITIVE_INFINITY)
operator fun div(other: Vector3<T, *>) = create(x / other.x, y / other.y, z / other.z, POSITIVE_INFINITY)
operator fun div(other: Vector4<T, *>) = create(x / other.x, y / other.y, z / other.z, w / other.w)
*/


operator fun <V: Vector<*, V>> Number.div(vec: V):V = vec.divBy(this)

operator fun<T:Number,K: Vector2<T, K>> Vector2<T, *>.div(other: Vector2<T, K>) = other.create(x / other.x, y / other.y)
operator fun<T:Number,K: Vector3<T, K>> Vector2<T, *>.div(other: Vector3<T, K>) = other.create(x / other.x, y / other.y, POSITIVE_INFINITY)
operator fun<T:Number,K: Vector4<T, K>> Vector2<T, *>.div(other: Vector4<T, K>) = other.create(x / other.x, y / other.y, POSITIVE_INFINITY, POSITIVE_INFINITY)

operator fun<T:Number,V: Vector3<T, V>> Vector3<T, V>.div(other: Vector2<T, *>) = create(x / other.x, y / other.y, POSITIVE_INFINITY)
operator fun<T:Number,K: Vector3<T, K>> Vector3<T, K>.div(other: Vector3<T, *>) = create(x / other.x, y / other.y, z / other.z)
operator fun<T:Number,K: Vector4<T, K>> Vector3<T, *>.div(other: Vector4<T, K>)             = other.create(x / other.x, y / other.y, z / other.z, POSITIVE_INFINITY)
//operator fun<T:Number,K: Quaternion<T, K>> Vector3<T, *>.div(rotation: K)       = rotation / this

operator fun<T:Number,V: Vector4<T, V>> Vector4<T, V>.div(other: Vector2<T, *>) = create(x / other.x, y / other.y, POSITIVE_INFINITY, POSITIVE_INFINITY)
operator fun<T:Number,V: Vector4<T, V>> Vector4<T, V>.div(other: Vector3<T, *>) = create(x / other.x, y / other.y, z / other.z, POSITIVE_INFINITY)
operator fun<T:Number,V: Vector4<T, V>> Vector4<T, V>.div(other: Vector4<T, *>) = create(x / other.x, y / other.y, z / other.z, w / other.w)
